import java.util.Arrays;
import java.util.Scanner;

public class demo01 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] arr=new int[n];
        for (int i = 0; i < n; i++) {
            arr[i]=sc.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(count(arr,0,0,1));
    }
    public static int count(int[] arr,int pos,int sum,int mulit){
        int count=0;
        for (int i = pos; i < arr.length; i++) {
            sum+=arr[i];
            mulit*=arr[i];
            if(sum>mulit){
                count=count+1+count(arr,i+1,sum,mulit);
            } else if (arr[i]==1) {
                count=count+count(arr,i+1,sum,mulit);
            }else{
                break;
            }
            sum-=arr[i];
            mulit/=arr[i];
            while (i<arr.length-1&&arr[i]==arr[i+1]){
                i++;
            }
        }
        return count;
    }
}
